<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>优惠券管理 - 优惠券发放</title>
<style type="text/css">

    #txt1 {
        width: 99%;
    }

    #div_items {
        position: relative;
        width: 100%;
        height: 200px;
        border: 1px solid #66afe9;
        border-top: 0px;
        overflow: auto;
        display: none;
    }

    .div_item {
        width: 100%;
        height: 20px;
        margin-top: 1px;
        font-size: 13px;
        line-height: 20px;
    }
</style>
<?php include($this->c['_homes']['_viewsHome'].'/_global/_head.php');?>
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/head.php');?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container" > 
  <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
  <?php include($this->c['_homes']['_viewsHome'].'/_global/menu.php');?>
  <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR --> 
  <!-- BEGIN PAGE -->
  <div class="page-content"> 
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title"> 优惠券发放 </h3>
        <ul class="page-breadcrumb breadcrumb">
          <li> <i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i> </li>
          <li> <a href="/coupon/clist?type=0">优惠券列表</a> <i class="icon-angle-right"></i> </li>
          <li>优惠券发放</li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB--> 
      </div>
    </div>
    <!-- END PAGE HEADER--> 
    <!-- BEGIN PAGE CONTENT-->
    
    <div class="row">
      <div class="col-md-9"> 
        <!-- BEGIN SAMPLE FORM PORTLET-->
        <div class="portlet box blue">
          <div class="portlet-title">
            <div class="caption"> <i class="icon-reorder"></i>基本信息 </div>
            <div class="tools"> <a href="" class="collapse"></a> </div>
          </div>
          <div class="portlet-body form">
            <form method="post" class="form-horizontal" onSubmit="return chkfrm();"  action="save">
              <input type="hidden" name="act" value="send_coupon" />
              <input type="hidden" name="dis_id" value="<?=$_GET['dis_id']?>" />
              <div class="form-body">

                   <div class="form-group">
                      <label class="col-md-3 control-label">发放人<span class="required">*</span></label>
                      <div class="col-md-4">
                         
                          <input type="text" class="form-control" name="uid" id="parent_uid" value="" placeholder="请输入真实姓名"/>

                         
                          <div id="div_items">
                            
                          </div>
                      </div>
                  </div>
                     <div class="form-group">
                      <label class="col-md-3 control-label">发放数量<span class="required">*</span></label>
                      <div class="col-md-4">
                         
                          <input type="text" class="form-control" name="send_num" id="send_num" value="1" placeholder="请输入发放数量"/>

                         
                      </div>
                  </div>
                                    
              </div>
              <div class="form-actions fluid">
                <div class="col-md-offset-3 col-md-9">
                  <button type="submit" class="btn blue">提交</button>
                  <button type="button" class="btn default" onClick="history.back(1);">取消</button>
                </div>
              </div>
            </form>
          </div>
        </div>
        <!-- END SAMPLE FORM PORTLET--> 
        
      </div>
    </div>
    <!-- END PAGE CONTENT--> 
  </div>
  <!-- END PAGE --> 
</div>
<!-- END CONTAINER -->

<?php include($this->c['_homes']['_viewsHome'].'/_global/_footer.php');?>


<script>
jQuery(document).ready(function() {    
   App.init();
    function ajaxDirect(url,data,func,async){
        if(!async){
            async = false;
        }
        $.ajax({
            url:url,
            type:"post",
            dataType:"json",
            async:async,
            data:data,
            success:func
        });
    }



    //文本框输入
    $("#parent_uid").on('input propertychange',function(){
    //$("#parent_uid").keyup( function () {
        ajaxDirect("ajax",{"act":"ajax_member","info":$("#parent_uid").val()},function(data){
            var htm = "";
            $('#div_items').html('');
            if(data['all_member']){
                for ( var int = 0; int < data['all_member'].length; int++) {
                    htm += "<div class='div_item' >"+data['all_member'][int].uid+"-"+ data['all_member'][int].realname +"</div>";
                }
                $('#div_items').append(htm);
            }else{
           	 $('#div_items').html('');
                }

        });

        $("#parent_uid").click(function () {
            $("#div_items").css('display', 'block');
            return false;
        });

        //隐藏列表框
        $("body").click(function () {
            $("#div_items").css('display', 'none');
        });

        $("#div_items").css('display', 'block');//只要输入就显示列表框

        if ($("#parent_uid").val().length <= 0) {
            $(".div_item").css('display', 'block');//如果什么都没填，跳出，保持全部显示状态
            return;
        }

        //项点击
        $(".div_item").click(function () {
            $("#parent_uid").val($(this).text());
        });
    });


});

function chkfrm(){
	
	
    if($("#parent_uid").prop("value")==""){
		alert("请选择用户");
		
		return false;
	}
    if($("#send_num").prop("value")=="" || $("#send_num").prop("value")<=0){
		alert("请输入发放数量");
		
		return false;
	}

  
}

</script>

<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>